package com.example.jqying.androiddemo.vistorPattern.vistor;

import com.example.jqying.androiddemo.vistorPattern.data.ConsumeBill;
import com.example.jqying.androiddemo.vistorPattern.data.IncomeBill;
import com.example.jqying.androiddemo.vistorPattern.vistorInterface.IAccountBookView;

/**
 * Created by apple on 2018/7/3.
 */

public class CPA implements IAccountBookView {
    int count;
    int income;
    int consume;

    @Override
    public void view(ConsumeBill consumeBill) {
        count ++;
        consume+=consumeBill.getAmount();
    }

    @Override
    public void view(IncomeBill incomeBill) {
        count ++;
        income += incomeBill.getAmount();
    }

    public String getResult(){
        return "Consume:"+consume+"---"+"Income:"+income+"---"+"Total Count:"+count;
    }
}
